class Solution {
public:
    int accountBalanceAfterPurchase(int n)
    {
        if (n % 10 < 5) n -= (n % 10);
        if (n % 10 > 5) n += (10 - n % 10);
        if (n % 10 == 5) n += 5;
        return 100 - n;
    }
};